<!DOCTYPE html>
<html>
<head>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
</head>
<body>

<h1 id="title">数组测试</h1>

<script type="text/javascript">
    String.prototype.format = function()
    {
        var args = arguments;
        return this.replace(/\{(\d+)\}/g,
                function(m,i){
                    return args[i];
                });
    }
    var s="I am {0},My name is {1},I am {0}";
    var s1=s.format("daniel","daniel2");
    console.log(s);
    console.log(s1);
</script>
</body>
</html>

